import { getStore, setStore } from "../../utils/storage";
export default {
  state: {
    menuList: getStore("menuList") || [], //侧边栏菜单列表
    editableTabs: getStore("editableTabs") || [], //导航栏动态标签列表
    isCollapse: getStore("isCollapse") || false, //控制侧边栏是否折叠
    menuActiveName: getStore("menuActiveName") || "", //当前选中的左侧菜单name
    mainTabsActiveName: getStore("mainTabsActiveName") || "home", //顶部导航标签当前选中的name
    themeColor: getStore("mainTabsActiveName") || "", //全局颜色,
    fullscreenFlag: getStore("fullscreenFlag") ? getStore("fullscreenFlag") :"true",//控制全屏按钮是否显示
    mainColorFlag: getStore("mainColorFlag") ? getStore("mainColorFlag") :"true",//控制主题色按钮是否显示
    isnavoff: getStore("isnavoff") ? getStore("isnavoff") : "true", //控制导航是否切换
    navToggleFlag: getStore("navToggleFlag") ? getStore("navToggleFlag") :"true",//控制导航按钮是否显示
  },
  mutations: {
    menuList(state, list) {
      state.menuList = list;
      setStore("menuList", state.menuList);
    },
    updateSidebarFold(state, fold) {
      state.isCollapse = fold;
      setStore("isCollapse", state.isCollapse);
    },
    updateTabsTag(state, list) {
      state.editableTabs = list;
      setStore("editableTabs", state.editableTabs);
    },
    updatemenuActiveName(state, name) {
      state.menuActiveName = name;
      setStore("menuActiveName", state.menuActiveName);
    },
    updateMainTabsActiveName(state, name) {
      state.mainTabsActiveName = name;
      setStore("mainTabsActiveName", state.mainTabsActiveName);
    },
    M_THEME_COLOR(state, name) {
      state.themeColor = name;
      setStore("themeColor", state.themeColor);
    },
    updatefullscreenFlag(state, name) {
      state.fullscreenFlag = name;
      setStore("fullscreenFlag", state.fullscreenFlag);
    },
    updatemainColorFlag(state, name) {
      state.mainColorFlag = name;
      setStore("mainColorFlag", state.mainColorFlag);
    },
    updateisnavoff(state,name) {
      state.isnavoff = name;
      setStore("isnavoff", state.isnavoff);
    },
    updatenavToggleFlag(state,name) {
      state.navToggleFlag = name;
      setStore("navToggleFlag", state.navToggleFlag);
    },
  },
  actions: {}
};
